package com.zkthink.ceres.product.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zkthink.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商品的sku
 * </p>
 *
 * @author JustArgo
 * @since 2020-05-18
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_product_sku")
@ApiModel(value = "ProductSku", description = "商品的sku")
@AllArgsConstructor
public class ProductSku extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 店铺id
     */
    @ApiModelProperty(value = "店铺id")
    @NotNull(message = "店铺id不能为空")
    @TableField("store_id")
    @Excel(name = "店铺id")
    private Long storeId;

    /**
     * sku编码
     */
    @ApiModelProperty(value = "sku编码")
    @Length(max = 255, message = "sku编码长度不能超过255")
    @TableField(value = "sku_code", condition = LIKE)
    @Excel(name = "sku编码")
    private String skuCode;

    /**
     * sku的规格值组合，例如：红色 43码
     */
    @ApiModelProperty(value = "sku的规格值组合，例如：红色 43码")
    @Length(max = 255, message = "sku的规格值组合，例如：红色 43码长度不能超过255")
    @TableField(value = "sku_name_str", condition = LIKE)
    @Excel(name = "sku的规格值组合，例如：红色 43码")
    private String skuNameStr;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品id")
    @TableField("product_id")
    @Excel(name = "商品id")
    private Long productId;

    /**
     * 销售价
     */
    @ApiModelProperty(value = "销售价")
    @TableField("sku_price")
    @Excel(name = "销售价")
    private Long skuPrice;

    /**
     * 采购价
     */
    @ApiModelProperty(value = "采购价")
    @TableField("apply_price")
    @Excel(name = "采购价")
    private Long applyPrice;

    /**
     * sku的图片
     */
    @ApiModelProperty(value = "sku的图片")
    @Length(max = 200, message = "sku的图片长度不能超过200")
    @TableField(value = "sku_img", condition = LIKE)
    @Excel(name = "sku的图片")
    private String skuImg;

    /**
     * sku的库存
     */
    @ApiModelProperty(value = "sku的库存")
    @TableField("sku_stock")
    @Excel(name = "sku的库存")
    private Integer skuStock;

    /**
     * 重量，单位(千克)
     */
    @ApiModelProperty(value = "重量，单位(千克)")
    @TableField("weight")
    @Excel(name = "重量，单位(千克)")
    private Double weight;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public ProductSku(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime, 
                    Long storeId, String skuCode, String skuNameStr, Long productId, Long skuPrice, 
                    Long applyPrice, String skuImg, Integer skuStock, Double weight, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.storeId = storeId;
        this.skuCode = skuCode;
        this.skuNameStr = skuNameStr;
        this.productId = productId;
        this.skuPrice = skuPrice;
        this.applyPrice = applyPrice;
        this.skuImg = skuImg;
        this.skuStock = skuStock;
        this.weight = weight;
        this.isDelete = isDelete;
    }

}
